import Vue from 'vue'
import VueRouter from 'vue-router'
import Find from '@/views/Find'
import My from '@/views/My'
import Part from '@/views/Part'

import List from '@/views/List'
import Article from '@/views/Article'
import Login from '@/views/Login'
import Register from '@/views/Register'
import NotFound from '@/views/NotFound'


Vue.use(VueRouter)
const router = new VueRouter({
    // 路由的规则

    mode: 'history',// history 模式 打包上线后需要后台支持
    // route: 一条路由 规则
    //router: 路由器
    routes: [
        /* 设置默认页面 */
        {
            path: '/',
            redirect: '/find'
        },
        {
            // 路径 锚点
            // 组件
            path: '/find',
            name: 'find',
            component: Find,
        },
        {
            path: '/my',
            name: 'my',
            component: My,
        },
        {
            path: '/part',
            name: 'part',
            component: Part,
        },
        {
            path: '/part/:username',
            component: Part,
        },

        {
            path: '/list',
            component: List,
        },
        {
            path: '/article',
            component: Article,
        },
        {
            path: '/login',
            component: Login,
        },
        {
            path: '/register',
            component: Register,
        },
        {
            path: '*',
            component: NotFound
        }
    ],
})
export default router